import request from '../utils/request'

/**
 * 分页多条件查询图书信息
 */
export function getPageBook(pageNum, pageSize, searchObj) {
    return request({
        url: 'book/'+pageNum+'/'+pageSize,
        method: 'get',
        params: searchObj
    })
}

/**
 * 添加图书
 */
export function addBook(book) {
    return request({
        url: 'book',
        method: 'post',
        data: book
    })
}

/**
 * 删除图书
 */
export function deleteBookById(id) {
    return request({
        url: 'book/'+id,
        method: 'delete'
    })
}

/**
 * 数据回显接口
 */
export function getBookById(id) {
    return request({
        url: 'book/backend/'+id,
        method: 'get'
    })
}

/**
 * 修改图书信息
 */
export function updateBook(book) {
    return request({
        url: 'book',
        method: 'put',
        data: book
    })
}

/**
 * 修改图书状态
 */
export function updateBookStatus(id, status) {
    return request({
        url: 'book/'+id+'/'+status,
        method: 'put'
    })
}

/**
 * 批量删除
 */
export function deleteBatchByIds(ids) {
    return request({
        url: 'book',
        method: 'delete',
        data: ids
    })
}
